package com.googlecode.openrtp.spi.rtcp;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author jocke
 */
public class RtcpCompoundPacket {

    private Map<Integer, RtcpPacket> packets;

    public RtcpCompoundPacket() {
        this.packets = new HashMap<Integer, RtcpPacket>(10);
    }
    
    public RtcpSourceDescriptionPacket getDescriptionPacket() {
        return (RtcpSourceDescriptionPacket) packets.get(RtcpHeaderPacket.PT.SOURCE_DESC);
    }

    public RtcpSenderPacket getSenderPacket() {
        return (RtcpSenderPacket) packets.get(RtcpHeaderPacket.PT.SENDER_REPORT);
    }

    public RtcpPacket putPacket(Integer key, RtcpPacket value) {
        return packets.put(key, value);
    }
    
    public boolean containsPacket(Integer type) {
        return packets.containsKey(type);
    }

    public int size() {
        return packets.size();
    }
    
    @Override
    public String toString() {
        return "RtcpCompoundPacket{" + "packets=" + packets + '}';
    }
    
}
